package com.sds.sweng.swat.miplatform.ui.design.models;

import org.eclipse.gef.requests.CreationFactory;

import com.sds.sweng.swat.miplatform.ui.design.models.area.AreaTemplate;

public class ModelFactory implements CreationFactory {

	private Object template;

	public ModelFactory(Object template) {
		this.template = template;
	}

	public Object getNewObject() {
		try {
			AreaTemplate areaTemplate = ((AreaTemplate) ((Class) template).newInstance());
			areaTemplate.init();
			return areaTemplate;
		} catch (Exception e) {
			return null;
		}
	}

	public Object getObjectType() {
		return template;
	}

}
